//
//  RotateShape.m
//  QuartzStudy
//
//  Created by longhuihu on 11-6-21.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "RotateShape.h"

#define PI 3.14159
#define RADIANS(x) PI*(x)/180 

@implementation RotateShape

@synthesize rotateDegree;

- (void)drawRect:(CGRect)rect
{
	CGContextRef context = UIGraphicsGetCurrentContext();
	CGRect bounds = self.bounds;
	CGContextClearRect(context, bounds);
	CGContextTranslateCTM(context, bounds.size.width/2, bounds.size.height/2);
	CGContextRotateCTM(context, RADIANS(rotateDegree));
	
	CGFloat colorComponents[] = {1.0,0.0,0.0,1.0};
	CGContextSetStrokeColor(context, colorComponents);
	CGContextAddEllipseInRect(context, CGRectMake(-150,-50,300,100));
	CGContextDrawPath(context, kCGPathStroke);
}


@end
